/* JS for tab "homepage" Visual Narrative Strategies panel & Editorial Layers */

class Homepage_Panel {

    constructor (btn_json_url, panel_title, panel_name) {
        this._btn_json_url = btn_json_url + "";
        this._panel_title = panel_title + "";
        this._panel_name  = panel_name + "";
        this._btn_queue = [];  // save btn items
        if(this._btn_json_url.substring(this._btn_json_url.length-5) !== ".json") {
            console.error("Please check your URL format (.JSON)!");
            return ;
        }
    }

    _createPanel () {
        $.getJSON(this._btn_json_url, json => {

            $.each(json, (i, item) => {
                let btn_node = this._createButton(item, this._panel_name, extraNode);
                this._appendTo_queue(btn_node); // append btn to panel queue
            });
        })
    }

    _createButton () {

    }

    _appendTo_queue (btn_node) {
        if(!(btn_node instanceof HTMLElement)) {
            console.error("This button item is not a HTML Element!");
            return false;
        }

        this._btn_queue.push(btn_node);
    }
}